package org.person;

import org.mybatis.spring.annotation.MapperScan;
import org.person.test.intercepter.AuthInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@SpringBootApplication
@MapperScan("org.person.*.mapper")
//@ServletComponentScan("org/person/basic/listener")
public class PermissionApp implements WebMvcConfigurer {

    public static void main(String[] args) {

        SpringApplication.run(PermissionApp.class,args);
    }
    @Autowired
    private AuthInterceptor authInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(authInterceptor)
                .addPathPatterns("/**")
                .excludePathPatterns("/login","/loginOut");
    }
}
